/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2019-2019.
 * Description: support preempt off feature
 * Author: chenshiyan
 * Create: 2019-5-8
 */
#ifndef _RTOS_PREEMPT_OFF_H
#define _RTOS_PREEMPT_OFF_H

#define PREEMPT_ON	0	/* kernel is preemptible */
#define PREEMPT_OFF	1	/* kernel is not preemptible */

#ifndef __ASSEMBLER__
extern int preempt_status;

#ifdef CONFIG_PPC32
extern unsigned int patch__kernel_preempt_off; /* Insn to be replaced by NOP */
#endif

static inline int check_preempt_off(void)
{
	return preempt_status == PREEMPT_OFF;
}

static inline char *get_preempt_str_uppercase(void)
{
	if (check_preempt_off())
		return "PREEMPT(OFF)";

	return "PREEMPT";
}

static inline char *get_preempt_str_lowercase(void)
{
	if (check_preempt_off())
		return "preempt(off)";

	return "preempt";
}
#endif
#endif
